package java6681.lesson04;

import java.util.Arrays;
import java.util.Random;

public class Datas6681 {
    public static void main(String[] args) {
        int[] arr = new int[10];
        Random ran = new Random();

        for (int i = 0;i < arr.length;i++) {
            boolean flag = false;
            do {
                flag = false;
                int num = ran.nextInt(40)+21;//20-60

                arr[0] = 20;//必须包括20，60
                arr[1] = 60;

                for (int j = 0; j < i; j++) {//判断数字的重复
                    if (num == arr[j]) {
                        flag = true;
                        break;
                    }
                }

                if (!flag){
                    arr[i] = num;
                }
            }while(flag);
        }
        Arrays.sort(arr);
        System.out.print(Arrays.toString(arr));

    }
}
